package com.shooter.utils;

import java.lang.reflect.Field;
import java.util.HashMap;

public class Check {
    private static final HashMap<String, Field[]> Fields = new HashMap<>();

    //从缓存中获取反射的变量
    public static Field[] getField(Class aClass) {
        Field[] fields = Fields.get(aClass.getName());
        if (fields == null) {
            fields = aClass.getDeclaredFields();
            for (int i = 0; i < fields.length; i++) {
                fields[i].setAccessible(true);
            }
            Fields.put(aClass.getName(), fields);
        }
        return fields;
    }

}
